package ysq.xyg.web.model.po;

import lombok.Data;
import lombok.NoArgsConstructor;
import ysq.xyg.base.util.BaseConstant;
import ysq.xyg.base.util.BaseUtil;
import ysq.xyg.sys.model.po.SysUser;

import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable;
import java.util.Date;

/**
 * 业务模块-APP菜单-业务模块-APP菜单实体类
 *
 * @author congcong tao
 * @date 2019-10-29 10:20:29
 */
@Data
@NoArgsConstructor
@Table(name = "xyg_web_app_menu")
public class WebAppMenu implements Serializable{

	/**
	 * id
	 */
	@Id
	private String id;

	/**
	 * 应用主键
	 */
	@Column(name = "account_id")
	private String accountId;

	/**
	 * 菜单名称
	 */
	@Column(name = "name")
	private String name;

	/**
	 * 范围类型1=首页
	 */
	@Column(name = "scope_type")
	private String scopeType;

	/**
	 * 图标
	 */
	@Column(name = "icon")
	private String icon;

	/**
	 * app跳转链接
	 */
	@Column(name = "jump_url")
	private String jumpUrl;

	/**
	 * 类型1=跳转页面2=弹窗3=其他
	 */
	@Column(name = "jump_type")
	private String jumpType;

	/**
	 * 跳转参数，如果是文章等，可以写死成code码或id
	 */
	@Column(name = "app_params")
	private String appParams;

	/**
	 * 后台跳转
	 */
	@Column(name = "url")
	private String url;

	/**
	 * 类型1=app跳转2=文章信息跳转3=其他
	 */
	@Column(name = "type")
	private String type;

	/**
	 * 可以根据code判断是否需要权限等操作
	 */
	@Column(name = "code")
	private String code;

	/**
	 * 是否可编辑，默认为1，不可编辑，2可编辑
	 */
	@Column(name = "edit_type")
	private String editType;

	/**
	 * 排序
	 */
	@Column(name = "sort")
	private Integer sort;

	/**
	 * 是否删除：1-未删除；2-已删除
	 */
	@Column(name = "remove_tag")
	private String removeTag;

	/**
	 * 创建人
	 */
	@Column(name = "create_user")
	private String createUser;

	/**
	 * 更新人
	 */
	@Column(name = "update_user")
	private String updateUser;

	/**
	 * 创建时间
	 */
	@Column(name = "create_time")
	private Date createTime;

	/**
	 * 更新时间
	 */
	@Column(name = "update_time")
	private Date updateTime;

	public WebAppMenu(SysUser sysUser) {
		this.id = BaseUtil.uId();
		this.accountId = sysUser.getAccountId();
		this.removeTag= BaseConstant.BASE_REMOVE_TAG_NORMAL;
		this.createTime = new Date();
		this.createUser = sysUser.getId();
		this.updateTime = new Date();
		this.updateUser = sysUser.getId();
	}
}